package Java7_Concurrency_Cookbook.concurrent_custom.custom_thread_factory;

/**
 * <b>实现ThreadFactory接口生成定制线程</b><br/>
 * 本示例中用定制的线程工厂(MyThreadFactory)生成了定制的线程(MyThread)
 * @author lixiangke
 * @date 2017/11/24
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        MyThreadFactory myThreadFactory = new MyThreadFactory("MyThreadFactory");
        MyTask myTask = new MyTask();
        Thread thread = myThreadFactory.newThread(myTask);
        thread.start();
        thread.join();
        System.out.printf("Main: Thread information.\n");
        System.out.printf("%s.\n", thread);
        System.out.println("Main: End of the program");
    }
}
